﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AI_Tank;

namespace AI_Tank.Game
{
    public struct Position
    {
        private int x, y;

        public int X
        {
            get
            {
                return x;
            }
        }

        public int Y
        {
            get
            {
                return y;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void setPosition(int x,int y)
        { 
            this.x = x;
            this.y = y;
        }
    }
    public class Bullet
    {
        private BulletType type;
        private int teamID;
        private Position position;
        private Direction direction;

        public BulletType Type
        {
            get
            {
                return type;
            }
        }

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        internal Position Position
        {
            get
            {
                return position;
            }
        }

        public Direction Direction
        {
            get
            {
                return direction;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <param name="position"></param>
        /// <param name="dir"></param>
        public Bullet(BulletType type,int id,Position position,Direction dir)
        {
            this.type = type;
            this.teamID = id;
            this.position = position;
            this.direction = dir;
        }
    }
    public class Player
    {
        private int id;
        private int teamID;
        private Position position;
        private bool hasSuperBullet;

        public int Id
        {
            get
            {
                return id;
            }
        }

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        internal Position Position
        {
            get
            {
                return position;
            }
        }

        public bool HasSuperBullet
        {
            get
            {
                return hasSuperBullet;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="teamID"></param>
        /// <param name="position"></param>
        /// <param name="hasSuper"></param>
        public Player(int id,int teamID,Position position,bool hasSuper)
        {
            this.id = id;
            this.teamID = teamID;
            this.position = position;
            this.hasSuperBullet = hasSuper;
        }
    }
    public class Team
    {
        private int teamID;
        private int point;
        private int remainLife;

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        public int Point
        {
            get
            {
                return point;
            }
        }

        public int RemainLife
        {
            get
            {
                return remainLife;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="point"></param>
        /// <param name="remainLife"></param>
        public Team(int id,int point,int remainLife)
        {
            this.teamID = id;
            this.point = point;
            this.remainLife = remainLife;
        }
    }
    public class Goods
    {
        private Position position;
        private ElementType elementType;
    
        public Position Position
        {
            get
            {
                return position;
            }
        }

        public ElementType ElementType
        {
            get
            {
                return elementType;
            }
        }

        public void setPosition(Position p)
        {
            position.setPosition(p.X,p.Y);
        }
        public void setType(ElementType eleType)
        {
            elementType = eleType;
        }
    } 
    public class BrickWall:Goods
    {
        public BrickWall(Position p)
        {
            setPosition(p);
            base.setType(ElementType.BrickWall);
        }
    }
    public class IronWall : Goods
    {
        public IronWall(Position p)
        {
            setPosition(p);
            base.setType(ElementType.IronWall);
        }
         
    }
    public class River : Goods
    {
        public River(Position p)
        {
            setPosition(p);
            base.setType(ElementType.River);
        }
    }
    public class Star : Goods
    {
        public Star(Position p)
        {
            setPosition(p);
            base.setType(ElementType.Star);
        }
    }
    public class Coin : Goods
    {
        int point;
        public Coin(Position p,int point)
        {
            setPosition(p);
            this.point = point;
            base.setType(ElementType.Coin);
        }

        public int Point
        {
            get
            {
                return point;
            }
        }
    }
    public class RoundData
    {
        private int roundID;
        private List<Bullet> bullets;
        private List<Player> players;
        private List<Team> teams;
        private List<BrickWall> brickwalls;
        private List<IronWall> ironwalls;
        private List<River> rivers;
        private List<Star> stars;
        private List<Coin> coins;

        public int RoundID
        {
            get
            {
                return roundID;
            }

            set
            {
                roundID = value;
            }
        }

        internal List<Bullet> Bullets
        {
            get
            {
                return bullets;
            }

            set
            {
                bullets = value;
            }
        }

        internal List<Player> Players
        {
            get
            {
                return players;
            }

            set
            {
                players = value;
            }
        }

        internal List<Team> Teams
        {
            get
            {
                return teams;
            }

            set
            {
                teams = value;
            }
        }

        internal List<BrickWall> Brickwalls
        {
            get
            {
                return brickwalls;
            }

            set
            {
                brickwalls = value;
            }
        }

        internal List<IronWall> Ironwalls
        {
            get
            {
                return ironwalls;
            }

            set
            {
                ironwalls = value;
            }
        }

        internal List<River> Rivers
        {
            get
            {
                return rivers;
            }

            set
            {
                rivers = value;
            }
        }

        internal List<Star> Stars
        {
            get
            {
                return stars;
            }

            set
            {
                stars = value;
            }
        }

        internal List<Coin> Coins
        {
            get
            {
                return coins;
            }

            set
            {
                coins = value;
            }
        }

        public RoundData(
            int id,
            List<Bullet> bullets,
            List<Player> players, 
            List<Team> teams, 
            List<BrickWall> brickwalls,
            List<IronWall> ironwalls, 
            List<River> rivers,
            List<Star> stars,
            List<Coin> coins)
        {
            RoundID = id;
            this.Bullets = bullets;
            this.Players = players;
            this.Teams = teams;
            this.Brickwalls = brickwalls;
            this.Ironwalls = ironwalls;
            this.Rivers = rivers;
            this.Stars = stars;
            this.Coins = coins;
        }

    }
}
